package com.zb.awt;

import java.util.ArrayList;
import java.util.Iterator;

public class ArrayListTest {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("3");
        list.add("5");
        list.add("6");
        list.add("7");

        doRemove(list);
        System.out.println(list);
    }

    private static void doRemove(ArrayList<String> list) {
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            if (s.equals("3"))
                iterator.remove();
        }
    }
}
